/* Hawk - An OSGI Based Test Framework
 *
 * Copyright (C) 2010 http://code.google.com/p/hawk-framework/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */
package org.hawk.gui.windows;

import com.vaadin.ui.Window;

/**
 * System Main window (background). It is a singleton used to store all localized
 * messages of the system
 * 
 * @author Rodrigo Prestes Machado
 * @version November 15, 2009
 */
@SuppressWarnings("serial")
public class MainWindow extends Window {

	/** Main Window instance **/
	private static MainWindow instance;
	
	/**
	 * Constructor. It is private to be 
	 * 
	 * @param title : The window title
	 */
	private MainWindow(String title) {
		super(title);
		setVisible(true);
	}

	/**
	 * This method is used to return a instance of MainWindow class
	 * 
	 * @param  Hawk interface title
	 * @return The unique instance of MainWindow class
	 */
	public static MainWindow getInstance(String title) {
		if (instance == null)
			instance = new MainWindow(title);
		return instance;
	}
	
	/**
	 * This method is used to return a instance of MainWindow class. Generally 
	 * it should be used after create the main window, in other words, don�t 
	 * use it to create the main window because it will stay with an empty title
	 * 
	 * @return The unique instance of MainWindow class
	 */
	public static MainWindow getInstance() {
		return getInstance(null);
	}
}